using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_costtypeMap : EntityTypeConfiguration<so_costtype>
    {
        public so_costtypeMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Cost_Type__, t.Description });

            // Properties
            this.Property(t => t.Cost_Type__)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Description)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("so_costtype");
            this.Property(t => t.Cost_Type__).HasColumnName("Cost Type #");
            this.Property(t => t.Description).HasColumnName("Description");
        }
    }
}
